export const getToken = function () {
  return localStorage.getItem("token");
};
// 调整颜色度辅助函数
export function adjustColor(color, amount) {
  // 将 rgb(x, y, z) 格式转换为组
  const rgb = color.match(/\d+/g).map(Number);
  // 调整颜色通道
  const adjusted = rgb.map((value) => {
    const newValue = value + amount;
    return Math.min(255, Math.max(0, newValue));
  });
  return `rgb(${adjusted.join(",")})`;
}

export const getUserMessage = function () {
  return localStorage.getItem("ecode_params");
};
export const getFatherUserMessage = function () {
  return window.parent.localStorage.getItem("ecode_params");
};

export const getUrlId = function () {
  const url = new URL(window.location.href)
  return url.searchParams.get("id")
}